import React, {Component} from 'react';
import { setForm } from '../../utils/setComponentUsed'

class Form extends Component {
    constructor(props) {
        super(props);
        setForm(props.ncProps, props.uid);
    }

    render() {
        const {createForm} = this.props.ncProps.form;
        return (
            <div className="area">
                { this.props.title ?
                    <div className="area-head">
                        <div className="title">
                            {this.props.title}
                        </div>
                    </div>
                    :
                    null
                }
                {createForm(this.props.uid, {
                    onAfterEvent: this.props.onAfterEvent
                })}
            </div>
        )
    }
}

export default Form
